<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>淘票票影城系统</title>
    <link rel="stylesheet" th:href="@{/css/semantic.min.css}">
    <link rel="stylesheet" th:href="@{/css/admin.css}">
    <script type="text/javascript" th:src="@{/js/jquery-3.4.1.js}"></script>
    <script type="text/javascript" th:src="@{/js/semantic.min.js}"></script>
    <style>
        #order_table{
            margin-top: 50px;
        }
    </style>
</head>
<body>
<div class="ui top attached  menu">
    <a class="ui item button"><i class="sidebar icon"></i>菜单 </a>
    <a th:href="@{/admin/logout}" class="right item"><i class="sign-out icon"></i>退出</a>
</div>
<div class="ui  sidebar inverted vertical menu">
    <div class="item">
        <h4 class="ui blue header">影城管理系统</h4>
    </div>
    <a th:href="@{/admin/index}" class="item">首页</a>
    <a th:href="@{/admin/hall}" class="item">影厅管理</a>
    <a th:href="@{/admin/time}" class="item">排片管理</a>
    <a th:href="@{/admin/cinema}" class="item">影院管理</a>
    <a th:href="@{/admin/orders}" class="active item">订单管理</a>
</div>

<div class="ui container" >
    <table id="order_table" class="ui compact teal table">
        <thead>
            <tr>
                <th></th>
                <th>订单编号</th>
                <th>订单价格</th>
                <th>订单手机号</th>
                <th>订单状态</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="order,stat:${orders}">
                <td th:text="${stat.count}"></td>
                <td th:text="${order.id}"></td>
                <td th:text="${order.money}"></td>
                <td th:text="${order.phone}"></td>
                <td th:text="${order.status}==1?'已完成':'未完成'"></td>
                <td>
                    <a th:href="@{/admin/order/{id}/delete(id=${order.id})}"
                       class="ui red basic button">删除</a>
                </td>
            </tr>
        </tbody>
    </table>
    <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon"></i>
        <div class="header">提示：</div>
        <p th:text="${message}">恭喜，操作成功！</p>
    </div>
</div>
<script>
    $(".ui.button").click(function () {
        $(".ui.sidebar")
            .sidebar({
                transition:'slide out'
            })
            .sidebar("toggle");
    });

    //消息提示关闭初始化
    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });

</script>
</body>
</html>